using System;
using UnityEngine;
using QFramework;
using UnityEngine.UI;

namespace ProjectMyFarmAndShe
{
	public partial class OperationItemTemplate : ViewController
	{
		public Text Text;
		public Button Operation;

		private void Awake()
		{
			Text = GetComponentInChildren<Text>();
			Operation = GetComponent<Button>();
		}

		void Start()
		{
			// Code Here
		}

		public void Init(OperationData data)
		{
			var cache = data;
			
			Text.text = cache.Content;
			Operation.onClick.AddListener(() =>
			{
				EventController.Default.TriggerEvent(cache.EventKey);
				UIGameController.Default.CloseDialogPanel();
			});
		}
	}
}
